<%@ page contentType="text/html;charset=UTF-8" language="java" deferredSyntaxAllowedAsLiteral="true"%>
<%@ include file="commons/taglibs.jsp" %>
<!DOCTYPE html>
<!-- saved from url=(0026)http://sell.fqapps.com/reg -->
<html class="js cssanimations"><head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
    <title>我的商品-一折微信淘客系统</title>

    <link rel="stylesheet" type="text/css" href="${ctx}/assets/css/amazeui.css">
    <link rel="stylesheet" type="text/css" href="${ctx}/assets/css/admin.css">
    <link rel="stylesheet" type="text/css" href="${ctx}/assets/css/style.css">

    <!--[if (gte IE 9)|!(IE)]><!-->
    <script type="text/javascript" src="${ctx}/assets/js/jquery.min.js"></script>
    <script type="text/javascript" src="${ctx}/assets/js/fastclick.min.js"></script>
    <script>$(function() {FastClick.attach(document.body);});</script>
    <!--<![endif]-->

    <script type="text/javascript" src="${ctx}/assets/js/amazeui.min.js"></script>
    <script type="text/javascript" src="${ctx}/assets/js/clipboard.min.js"></script>
</head>

<body>
<%@ include file="commons/dialog.jsp" %>
<jsp:include page="commons/head.jsp" flush="true" />
<script>
	
	var clipboard = new Clipboard('.share', {
        target: function() {
            return document.querySelector('.share_content');
        }
    });
	
    clipboard.on('success', function(e){
		e.trigger.innerHTML="已复制";
		e.trigger.style.backgroundColor="#9ED29E";
		e.trigger.style.borderColor="#9ED29E";
		$(".share_content").hide();
		// $("#fq_alert_info").html("<div class=\"am-text-danger\">成功复制以下内容，快去微信PC版粘贴吧：</div><div class=\"am-margin\" style=\"text-align: left;\">"+$(".share_content").html()+"</div>");
		//$('#fq_alert').modal();
    });

    clipboard.on('error', function(e) {
		$(".share_content").hide();
        $("#fq_alert_info").html("<div class=\"am-text-danger\">由于您的浏览器不兼容或当前网速较慢，复制失败，请手动复制或更换主流浏览器！</div><div class=\"am-margin\" style=\"text-align: left;\">"+$(".share_content").html()+"</div>");
		$('#fq_alert').modal();	
    });
	
</script>
	
<script>
$(function() {
	
	$(".share").on('click', function() { 
	
		var image = $(this).data('image');
		var recommended = $(this).data('recommended');
		var title = $(this).data('title');
		var price = $(this).data('price');
		var end_price = $(this).data('end_price');
		var url = $(this).data('url');
		var taowords = $(this).data('taowords');
		var coupons_taowords = $(this).data('coupons_taowords');
		var coupons = $(this).data('coupons');
		var clickurl= $(this).data('clickurl');
		var couponslink= $(this).data('couponslink');
		
		var share_str ="";
		var share_template = "{image}#{title}#【在售价{price}元，券后价{end_price}元】|【限时秒杀价{end_price}元】#{recommended}#抢购方法：点击链接进去，先领取优惠券，再复制淘口令下单：{url}";
		var share_array = new Array(); 
		share_array = share_template.split("#"); 
		for(var i in share_array){
			
			if(share_array[i].indexOf("{price}") >= 0){	
				var coupons_array = share_array[i].split("|");
				if(coupons > 0){
					share_str = share_str + coupons_array[0] + '<br>'
				}else{
					share_str = share_str + coupons_array[1] + '<br>'
				}
			}else if(share_array[i].indexOf("{coupons_taowords}") >= 0 && coupons_taowords == ''){	
			}else{
				share_str = share_str + share_array[i] + '<br>'
			}
			
		}
		
		
		share_str=share_str.replace('{image}','<img src="'+image+'">'); 
		share_str=share_str.replace('{title}',title); 
		share_str=share_str.replace('{price}',price); 
		share_str=share_str.replace('{end_price}',end_price); 
		share_str=share_str.replace('{recommended}',recommended); 
		share_str=share_str.replace('{taowords}',taowords); 
		share_str=share_str.replace('{coupons_taowords}',coupons_taowords); 
		share_str=share_str.replace('{coupons}',coupons); 
		share_str=share_str.replace('{clickurl}',clickurl); 
		share_str=share_str.replace('{couponslink}',couponslink); 
		share_str=share_str.replace('&amp;','&'); 
		console.log(share_str);
		
		if(recommended == ""){
			recommended = title;
		}
		
		//暂时不转短网址
		share_str=share_str.replace('{url}',url);
		$(".share_content").html(share_str);
		$(".share_content").show();
		return
		
		$.ajax({
			type:'post',
			url:"/api/shorturl3.html",
			async: false,
			data:{url:$(this).data('url')},
			success:function(data){
				if(data.status == 1){
					
					share_str=share_str.replace('{url}',data.shorturl);
					
					$(".share_content").html(share_str);
					$(".share_content").show();
					
				}else{
					
					share_str=share_str.replace('{url}',url);
					$(".share_content").html(share_str);
					$(".share_content").show();

				}
		
			}
		});
		
		
	});
	//商品下架
	$(".offline").on('click', function() { 
		$("#fq_true_confirm_info").text('您确定下架该商品吗？');
		$('#fq_true_confirm').modal({
			relatedTarget: this,
			onConfirm: function(options) {
				var $link = $(this.relatedTarget);
				
				$.ajax({
					type:'post',
					url:'/item/manage.html',
					data:{id:''+$link.data('id'),method:'offline'},
					success:function(data){
						if(data.status == 1){
					
							$("#fq_confirm_info").text(data.info);
							$('#fq_confirm').modal({
								closeViaDimmer:false,
								relatedTarget: this,
								onConfirm: function(options) {
									window.location.reload();
								},
								onCancel: function() {}
							});
					
						}else{
			
							$("#fq_alert_info").text(data.info);
							$('#fq_alert').modal();

						}
					}
				});
          
			},
			onCancel: function() {}
	
		});
		
	});
	//商品上架
	$(".online").on('click', function() { 
		$("#fq_true_confirm_info").text('您确定上架该商品吗？');
		$('#fq_true_confirm').modal({
			relatedTarget: this,
			onConfirm: function(options) {
				var $link = $(this.relatedTarget);
				
				$.ajax({
					type:'post',
					url:'/item/manage.html',
					data:{id:''+$link.attr('data-id'),method:'online'},
					success:function(data){
						if(data.status == 1){
					
							$("#fq_confirm_info").text(data.info);
							$('#fq_confirm').modal({
								closeViaDimmer:false,
								relatedTarget: this,
								onConfirm: function(options) {
									window.location.reload();
								},
								onCancel: function() {}
							});
					
						}else{
			
							$("#fq_alert_info").text(data.info);
							$('#fq_alert').modal();

						}
					}
				});
          
			},
			onCancel: function() {}
	
		});
		
	});

	//商品置顶
	$(".top").on('click', function() { 
		var top_value = $(this).attr('top_value');
		if(top_value==0){
			$("#fq_true_confirm_info").text('您确定置顶该商品吗？');
		}else{
		    $("#fq_true_confirm_info").text('您确定取消置顶该商品吗？');
		}
		
		$('#fq_true_confirm').modal({
			relatedTarget: this,
			onConfirm: function(options) {
				var $link = $(this.relatedTarget);
				
				$.ajax({
					type:'post',
					url:'/item/manage.html',
					data:{id:''+$link.attr('data-id'),method:'top',value:''+$link.attr('top_value')},
					success:function(data){
						if(data.status == 1){
					
							$("#fq_confirm_info").text(data.info);
							$('#fq_confirm').modal({
								closeViaDimmer:false,
								relatedTarget: this,
								onConfirm: function(options) {
									window.location.reload();
								},
								onCancel: function() {}
							});
					
						}else{
			
							$("#fq_alert_info").text(data.info);
							$('#fq_alert').modal();

						}
					}
				});
          
			},
			onCancel: function() {}
	
		});
		
	});




	$(".delete").on('click', function() { 
		$("#fq_true_confirm_info").text('您确定删除该商品吗？');
		$('#fq_true_confirm').modal({
			relatedTarget: this,
			onConfirm: function(options) {
				var $link = $(this.relatedTarget);
				
				$.ajax({
					type:'post',
					url:'/item/manage.html',
					data:{id:''+$link.data('id'),method:'delete'},
					success:function(data){
						if(data.status == 1){
					
							$("#fq_confirm_info").text(data.info);
							$('#fq_confirm').modal({
								closeViaDimmer:false,
								relatedTarget: this,
								onConfirm: function(options) {
									window.location.reload();
								},
								onCancel: function() {}
							});
					
						}else{
			
							$("#fq_alert_info").text(data.info);
							$('#fq_alert').modal();

						}
					}
				});
          
			},
			onCancel: function() {}
	
		});
		
	});

	$("#get_home_qrcode").on('click', function() {
	
		$("#itemqrcodesrc").attr("src","");
		$("#itemqrcodesrc").attr("src"," ");
		$('#item_qrcode').modal({});
	
	});
	
	$(".get_item_qrcode").on('click', function() {
		
		$("#itemqrcodesrc").attr("src","");
		$("#itemqrcodesrc").attr("src"," "+$(this).data('url'));
		$('#item_qrcode').modal({});
	
	});
	
	
	$('#search_type').change(function(){ 
		var op = $(this).children('option:selected').val();
		if(op == 3){
			$('#sp').show();
			$('#key').attr('placeholder','结束价格');
		}else{
			$('#sp').hide();
			$('#key').attr('placeholder','');
		}
	});
//全选按钮
$('#selectAll').click(function(){
	/*if($('.cbox').prop('checked')==true){
		$('.cbox').prop('checked',false);
	}else{
		$('.cbox').prop('checked',true);
	}*/
	if($('#selectAll').prop('checked')==true){
		$('.cbox').prop('checked',true);
	}else{
		$('.cbox').prop('checked',false);
	}
			                        
});	
//删除选中
$('#delete_all').click(function(){
	var a = $('input[name="idarr[]"]');//获取name="idarr[]"所有的input
	var length = a.length;//获取input的总数
	var b = new Array();
		for(var i = 0;i<length;i++){
		    if(a.eq(i).prop('checked')==true){
		              b[i]=a.eq(i).val();
		    }
		}
	if(b!=''){
	  	$("#fq_my_confirm_info").text('您确定要删除选中的商品吗？');
		$('#fq_my_confirm').modal({
			relatedTarget: this,
			onConfirm: function(options) {
				$('#delete_all').html('<i class="am-icon-trash" style="top: -1px;position: relative;"></i> 删除选中 <i class="am-icon-spinner am-icon-spin"></i>');
			    $.ajax({
			        type:'post',
			        url:"/item/del_items.html",
			        data:{'id':b},
			        success:function(data){
			           if(data.status==1){
						$('#delete_all').html('<i class="am-icon-trash" style="top: -1px;position: relative;"></i> 删除选中');
						$("#fq_confirm_info").text('删除成功');
                        $('#fq_confirm').modal({
                            relatedTarget: this,
                            onConfirm: function() {
                                window.location.reload();
                            },
                        });
			           }else{
			           		$('#delete_all').html('<i class="am-icon-trash" style="top: -1px;position: relative;"></i> 删除选中');
			           		$("#fq_alert_info").html("网络繁忙，请稍后再试");
							$('#fq_alert').modal();
			           }
			        }
			    });
			},
			onCancel: function() {}
		});

	}else{
		$("#fq_alert_info").html("您未选中任何要删除的商品");
		$('#fq_alert').modal();
	}
  	
});


//添加选中
$('#add_all').click(function(){
	var a = $('input[name="idarr[]"]');//获取name="idarr[]"所有的input
	var banner_did = $('input[name="idarr[]"]').attr('banner_did');
	//var banner_title = $('input[name="idarr[]"]').siblings('.addall').val();
	var length = a.length;//获取input的总数
	var b = new Array();
		for(var i = 0;i<length;i++){
		    if(a.eq(i).prop('checked')==true){
		              b[i]=a.eq(i).val();
		    }
		}
		
	if(b!=''){
		
				$('#doc-modal-1').modal({				
					relatedTarget: this,
					onConfirm: function(options) {
							var c = $('input[name="banner[]"]');
							var length = c.length;
							var d = new Array();
								for(var i = 0,j=0;i<length;i++){
				    				if(c.eq(i).prop('checked')==true){
				            		  d[j]=c.eq(i).val();
				            		  j++;
				   					 }
								}
  		
				       if(d!=''){ 
								$('#add_all').html('<i class="am-icon-plus" style="top: -1px;position: relative;"></i> 添加选中 <i class="am-icon-spinner am-icon-spin"></i>');
								$('#doc-modal-1').modal('close');

							    $.ajax({
							        type:'post',
							        url:"/item/add_items.html",
							        data:{'id':b,'banner_did':banner_did,'banner_mid':d},
							        success:function(data){
							           if(data.status==1){
							           	var key = $('.edit_recommended').attr('data-id');
								  		 //	alert(key);	
						           		var banner_title3 = $('.banner_title3'+key).text();
						           		var 	banner_title3arr = banner_title3.split(",");
						           	      $('.banner_title3'+key).text(banner_title3arr);
										$("#fq_confirm_info").text('添加成功');
				                        $('#fq_confirm').modal({
				                            relatedTarget: this,
				                            onConfirm: function() {
				                                window.location.reload();
				                            },
				                        });
							           }else{
							           		
							           		/*$("#fq_alert_info").html("该商品已经添加，请勿重复添加！");
											$('#fq_alert').modal();*/
											 $("#fq_confirm_info").text("该商品已经添加，请勿重复添加！");
				                                $('#fq_confirm').modal({
				                                    relatedTarget: this,
				                                    onConfirm: function () {
				                                        window.location.reload();
				                                    },
				                                });

												
								           }
								        }
								    });
	                        }else{
	                        	 $('#doc-modal-1').modal('close');
								 $("#fq_alert_info").html("您未选中任何专题");
								 $('#fq_alert').modal();
			 				}	
						},
						onCancel: function() {}
					});
		

	}else{
		$("#fq_alert_info").html("您未选中任何要添加的商品");
		$('#fq_alert').modal();
	}
  	
});

	//撤出专题
	$('#move_all').click(function(){
	var move_title = $('#move_title').val();
	var banner_did = $('input[name="idarr[]"]').attr('banner_did');
	var a = $('input[name="idarr[]"]');//获取name="idarr[]"所有的input
	var length = a.length;//获取input的总数
	var b = new Array();
		for(var i = 0;i<length;i++){
		    if(a.eq(i).prop('checked')==true){
		              b[i]=a.eq(i).val();
		    }
		}
	if(b!=''){
	  	$("#fq_my_confirm_info").text('您确定要把选中的商品撤出《'+move_title+'》专题页吗？');
		$('#fq_my_confirm').modal({
			relatedTarget: this,
			onConfirm:function(options) {
				$('#move_all').html('<i class="am-icon-trash" style="top: -1px;position: relative;"></i> 撤出选中 <i class="am-icon-spinner am-icon-spin"></i>');
			    $.ajax({
			        type:'post',
			        url:"/item/move_items.html",
			        data:{'id':b,'banner_did':banner_did},
			        success:function(data){
			           if(data.status==1){
						$('#move_all').html('<i class="am-icon-trash" style="top: -1px;position: relative;"></i> 撤出选中');
						$("#fq_confirm_info").text(data.info);
                        $('#fq_confirm').modal({
                            relatedTarget: this,
                            onConfirm: function() {
                                window.location.reload();
                            },
                        });
			           }else{
			           		$('#move_all').html('<i class="am-icon-trash" style="top: -1px;position: relative;"></i> 撤出选中');
			           		$("#fq_alert_info").html("网络繁忙，请稍后再试");
							$('#fq_alert').modal();
			           }
			        }
			    });
			},
			onCancel: function() {}
		});

	}else{
		$("#fq_alert_info").html("您未选中任何要撤出的商品");
		$('#fq_alert').modal();
	}
  	
});			



//修改推荐内容
$('.edit_recommended').click(function(){
	var oldid=$(this).attr('data-id');
	var old_content=$('#recommended'+oldid).text();
	$('#edit_content').val(old_content);
	$('#my-edit').modal({
      relatedTarget: this,
     onConfirm: function(e) {
     	var id = $(this.relatedTarget).attr('data-id');
     	var new_content=$.trim($('#edit_content').val());
     	$(this.relatedTarget).html('<i class="am-icon-edit"></i> <i class="am-icon-spinner am-icon-spin"></i>');
     	change=$(this.relatedTarget);
     	$.ajax({
	     	type:'post',
	     	url:"/item/edit_recommended.html",
	     	data:{'id':id,'new_content':new_content},
	     	dataType:'json',
	     	success:function(data){
	     		if(data.status==1){
	     			$('#recommended'+id).html(new_content);
	     			change.html('<i class="am-icon-edit"></i>');
	     			$('#fq_alert_info').text(data.info);
					$('#fq_alert').modal({});
	     		}else{
	     			change.html('<i class="am-icon-edit"></i>');
	     			$('#fq_alert_info').text(data.info);
					$('#fq_alert').modal({});
	     		}
	     			
	     	}
     	});
        
      },
   
    });
});
	

  
   
                
                        
                    

});


      
 
</script>

<script>

function search(){

	var type = $("#search_type").children('option:selected').val(); 
		
	if(type == 1){
		var title = $('#key').val();
		window.location.href=""+encodeURIComponent(title); 	
	}
	if(type == 2){
		var id = $('#key').val();
		window.location.href=""+id; 		
	}
	if(type == 3){
		var sp = $('#sp').val();
		var ep = $('#key').val();
		if(sp == undefined){sp = 0;}
		if(ep == undefined){ep = 0;}
		window.location.href=""+sp+"/ep/"+ep; 		
	}

	if(type == 4){
		var banner_name = $('#key').val();
		window.location.href=""+banner_name; 		
	}

}




</script>




<div class="am-cf admin-main">

<div class="am-modal am-modal-alert" tabindex="-1" id="to_be_continued">
  <div class="am-modal-dialog">
    <div class="am-modal-hd" id="fq_alert_title"></div>
    <div class="am-modal-bd" id="fq_alert_info">即将上线！</div>
    <div class="am-modal-footer">
      <span class="am-modal-btn">朕知道了</span>
    </div>
  </div>
</div>


<!-- sidebar start -->
  <jsp:include page="commons/left.jsp" flush="true" />
<!-- sidebar end -->  
<!-- Modal -->
<!-- 删除选中弹窗 -->
<div class="am-modal am-modal-confirm" tabindex="-1" id="fq_my_confirm">
  <div class="am-modal-dialog">
    <div class="am-modal-hd" id="fq_my_confirm_title"></div>
    <div class="am-modal-bd" id="fq_my_confirm_info"></div>
    <div class="am-modal-footer">
		<span class="am-modal-btn onfirm" data-am-modal-confirm="">确定</span>
		<span class="am-modal-btn" data-am-modal-cancel="">取消</span>
    </div>
  </div>
</div>

<div class="am-modal am-modal-prompt" tabindex="-1" id="my-edit">
	<div class="am-modal-dialog">
		<div class="am-modal-hd">修改推荐内容</div>
		<div class="am-modal-bd" style="padding-top:15px;background:#fff;">
		    <textarea name="edit_content" id="edit_content" cols="50" rows="5" placeholder="请输入推荐内容"></textarea>
		</div>
		<div class="am-modal-footer">
		    <span class="am-modal-btn" data-am-modal-confirm="">提交</span>
		    <span class="am-modal-btn" data-am-modal-cancel="">取消</span>
		</div>
	</div>
</div>

<!-- Modal -->

	<div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-1">

  		<div class="am-modal-dialog">

    		<div class="am-modal-hd am-text-left" style="border-bottom:1px solid #ddd;">

    			<div class="am-padding-horizontal-sm">选择加入的专题页面

    				<a href="javascript: void(0)" class="am-close am-close-spin cancel_tag" data-am-modal-close="">×</a>

    			</div>

    		</div>

    		<div class="am-modal-bd" style="margin-bottom:0;">

    			<ul>
                    <div class="am-fl" style="padding-left:10rem;"><a href="">暂无自定义专题，请点击添加</a></div>
   							
    				
    			</ul>

    			<div class="am-cf"></div>

    			<span class="num_tips am-text-left am-text-danger am-text-sm am-text-left am-padding-horizontal-sm am-margin-top-xs" style="display:block;"></span>


    		</div>

    		<div style="padding:15px 10px;border-top: 1px solid #ddd;">

    			<button type="button" class="am-btn am-btn-success am-text-sm am-padding-horizontal-lg save_tag" data-am-modal-confirm="" data-id="">确定</button>

				<button type="button" class="am-btn am-btn-default am-text-sm am-padding-horizontal-lg cancel_tag" data-am-modal-close="">取消</button>

    		</div>

  		</div>

	</div>

<!-- Modal -->


<div class="am-modal am-modal-prompt" tabindex="-1" id="my-edit-s">
	<div class="am-modal-dialog">
		<div class="am-modal-hd">修改栏目标题</div>
		<div class="am-modal-bd am-margin-horizontal-xs">	
			<div class="am-input-group  am-margin-vertical-xs">
	             <span class="am-input-group-label am-text-sm"><div style="width:120px;">最新推荐</div></span>
	             <input type="text" class="am-form-field" value="" id="first" maxlength="5">
			</div>
			<div class="am-input-group am-margin-vertical-xs">
	             <span class="am-input-group-label am-text-sm"><div style="width:120px;">秒杀</div></span>
	             <input type="text" class="am-form-field" value="" id="second" maxlength="5">
			</div>
			<div class="am-input-group am-margin-vertical-xs">
	             <span class="am-input-group-label am-text-sm"><div style="width:120px;">人气</div></span>
	             <input type="text" class="am-form-field" value="" id="third" maxlength="5">
			</div>
			<span class="am-text-sm">（最新推荐为最新发布的商品，秒杀为9.9以下的商品，人气为按销量由高到低排序，栏目名可自定义修改，但不能超过五个字）</span>
		</div>
		  
		<div class="am-modal-footer">
		    <span class="am-modal-btn" data-am-modal-confirm="">提交</span>
		    <span class="am-modal-btn" data-am-modal-cancel="">取消</span>
		</div>
	</div>
</div>



<!-- Modal -->
<!-- content start -->
<div class="admin-content"><div class="admin-content-body">
	
	
	<div class="am-margin-top-sm am-margin-left">
		<strong class="am-text-primary am-text-lg">我的商品</strong> / <small>My item</small>
	</div>
	
	<div class="am-margin">
	
		<div class="am-margin-bottom">
			<div class="am-form">
				<select class="am-fl" id="search_type" style="height:31px;width:120px;font-size:12px;">
					<option value="1">按商品标题搜索</option>
					<option value="2">按商品ID搜索</option>
					<option value="3">按价格区间搜索</option>
					<option value="4">按专题名称搜索</option>
				</select>
			</div>
			<div class="am-input-group am-fl" style="width: 252px;left: 20px;">
				<input type="text" placeholder="起始价格" id="sp" class="am-form-field" style="height: 31px;display:none;">
			</div>
			<div class="am-input-group" style="width: 300px;left: 20px;">
				<input type="text" placeholder="" id="key" class="am-form-field" style="height: 31px;" onkeydown="if(event.keyCode==13) {search();return false;}" value="">
				<span class="am-input-group-btn" style="">
					<button class="am-btn am-btn-default" type="button" onclick="search()" style="height: 31px;"><span class="am-icon-search" style="position: relative; top: -3px;"></span></button>
				</span>
			</div>
		</div>
		
		<div class="am-btn-group am-btn-group-xs am-margin-bottom-xs">
			<a type="button" href="" class="am-btn am-btn-default am-active">全部</a>
			<a type="button" class="am-btn am-btn-default " href="">女装</a><a type="button" class="am-btn am-btn-default " href="">男装</a><a type="button" class="am-btn am-btn-default " href="">内衣</a><a type="button" class="am-btn am-btn-default " href="">美妆</a><a type="button" class="am-btn am-btn-default " href="">配饰</a><a type="button" class="am-btn am-btn-default " href="">鞋品</a><a type="button" class="am-btn am-btn-default " href="">箱包</a><a type="button" class="am-btn am-btn-default " href="">儿童</a><a type="button" class="am-btn am-btn-default " href="">母婴</a><a type="button" class="am-btn am-btn-default " href="">居家</a><a type="button" class="am-btn am-btn-default " href="">美食</a><a type="button" class="am-btn am-btn-default " href="">数码</a><a type="button" class="am-btn am-btn-default " href="">家电</a><a type="button" class="am-btn am-btn-default " href="">其他</a><a type="button" class="am-btn am-btn-default " href="">秒杀</a>		</div>
		
		 
		
		<div class="am-article-lead am-margin-vertical-sm" style="width: 850px;top: -5px;position: relative;">
			<span class="am-icon-home" style="font-size: 19px;position: relative;top: 1px;"></span> 活动页面地址：
			<a target="_blank" href="http://578606e7892cc9da.m.1zhe.net">http://578606e7892cc9da.m.1zhe.net</a>（可设置到微信公众号菜单/QQ公众号菜单/微信群/朋友圈分享等）<br>
			<i class="am-icon-qrcode" style="font-size: 17px;margin-left: 2px;margin-right: 3px;top: 2px;position: relative;"></i> 活动页二维码：<a href="javascript:void(0)" id="get_home_qrcode">点击查看</a><br>			<i class="am-icon-cog" style="margin-left: 2px;font-size: 16px;margin-right: 2px;"></i> 分享模板设置：<a href="">点击设置</a>（自定义分享模板文案内容）<br>
			<i class="am-icon-magic" style="margin-left: 2px;margin-right: 3px;"></i> 修改栏目名称：<a href="javascript:void(0);" class="editcolumn">点击设置</a>（可自定义活动页面栏目名称）<br>
			<i class="am-icon-asterisk" style="margin-left: 2px;margin-right: 3px;"></i> 专题轮播设置：<a href="">点击设置</a>（可自定义开启活动页面专题图片轮播页面）
		</div>
	
		   

		<div class="share_content am-margin-bottom am-badge-success am-badge" id="share_content"></div>
		<ul class="am-nav am-nav-tabs">
			<li class="am-active">
				<a href="javascript:void(0);">进行中（0）</a>
			</li>
			<li>
				<a href="">未开始</a>
			</li>
			<li>
				<a href="">已过期</a>
			</li>
			<li>
				<a href="">已下架</a>
			</li>
			<li>
				<a href="">全部</a>
			</li> 
			<li class="">
				<a style="color: #5EB95E;" href="${ctx}/product/cleanPage.do"><i class="am-icon-trash" style="top: -1px;position: relative;"></i> 批量清理</a>
			</li>
			<!-- <li class="">
				<a style="color: #d7342e;cursor: pointer;" id="delete_all"><i class="am-icon-trash" style="top: -1px;position: relative;"></i> 删除选中</a>
			</li> -->
		</ul>
		
		<!--排序-->
		<div class="am-fl am-inline-block am-margin-bottom am-margin-right-xs am-margin-top-sm">													
			<!--下拉选择框-->							
				<div class="am-fl">							
					<select data-am-selected="{btnSize:&#39;sm&#39;}" id="sorting" style="display: none;">
						<option value="3" selected="">最新发布</option>
						<option value="0">优惠最多</option>							 
						<option value="1">销量最高</option>							  
						<option value="2">佣金比率最高</option>
						<option value="4">自定义排序</option>
					</select><div class="am-selected am-dropdown " id="am-selected-948cc" data-am-dropdown="">  <button type="button" class="am-selected-btn am-btn am-dropdown-toggle am-btn-sm am-btn-default">    <span class="am-selected-status am-fl">最新发布</span>    <i class="am-selected-icon am-icon-caret-down"></i>  </button>  <div class="am-selected-content am-dropdown-content">    <h2 class="am-selected-header"><span class="am-icon-chevron-left">返回</span></h2>       <ul class="am-selected-list">                     <li class="am-checked" data-index="0" data-group="0" data-value="3">         <span class="am-selected-text">最新发布</span>         <i class="am-icon-check"></i></li>                                 <li class="" data-index="1" data-group="0" data-value="0">         <span class="am-selected-text">优惠最多</span>         <i class="am-icon-check"></i></li>                                 <li class="" data-index="2" data-group="0" data-value="1">         <span class="am-selected-text">销量最高</span>         <i class="am-icon-check"></i></li>                                 <li class="" data-index="3" data-group="0" data-value="2">         <span class="am-selected-text">佣金比率最高</span>         <i class="am-icon-check"></i></li>                                 <li class="" data-index="4" data-group="0" data-value="4">         <span class="am-selected-text">自定义排序</span>         <i class="am-icon-check"></i></li>            </ul>    <div class="am-selected-hint"></div>  </div></div>							
				</div>							
			<!--下拉选择框结束-->						
		</div>	
		<!--排序结束-->
		<div>
		    <button type="button" style="height: 32px;" class="am-btn am-btn-danger am-text-xs am-margin-top-sm" id="delete_all"><span class="am-icon-trash-o"></span> 删除选中</button>
		  <button type="button" style="height: 32px;" class="am-btn am-btn-success am-text-xs am-margin-top-sm" id="add_all"><span class="am-icon-plus"></span> 加入专题</button>
		   
		  	<button class="am-btn am-text-xs am-btn-secondary am-margin-top-sm upset" style="height: 32px;"><i class="am-icon-random"></i> 打乱顺序	<span class="upsetbox" style="display:none;"> （<span class="upsetnum"></span><span class="upsettotal"></span>） </span></button>
		  	<button class="am-btn am-text-xs am-btn-primary am-margin-top-sm regain" style="height: 32px;"><i class="am-icon-refresh"></i> 恢复顺序</button>
		</div>
		<table class="am-table am-table-striped am-table-hover table-main">
			<thead>
              <tr>
               <th class="am-text-vertical"><!--<input type="checkbox" name="" id="selectAll" style="vertical-align: text-top;" />-->
				<label class="am-checkbox-inline" style="margin-bottom:21px;">
				<input type="checkbox" value="" data-am-ucheck="" class="default am-ucheck-checkbox" id="selectAll"><span class="am-ucheck-icons"><i class="am-icon-unchecked"></i><i class="am-icon-checked"></i></span><span class="am-ucheck-icons" style="opacity: 0;"><i class="am-icon-unchecked"></i><i class="am-icon-checked"></i></span>
				</label>
			   </th>
               <th style="width: 70px;">图片</th>
			   <th style="width: 300px;">标题/属性/淘口令</th>
			   <th style="width: 300px;">推荐内容</th>
			   <th>在售价</th>
			   <th>券后价</th>
			   <th>当前销量</th>
			   <th>券额</th>
			   <th>开始/结束时间</th>
			   <th>操作</th>
              </tr>
			</thead>
	
			<tbody>
							</tbody>

		</table>
		    		<ul class="am-pagination am-pagination-centered am-text-xs"></ul>	

		
	</div>
	
</div><footer class="admin-content-footer">
	<hr>
	<p class="am-padding-left">深圳前海刷云科技有限公司  CopyRight©2016  闽ICP备16026055号</p>
</footer></div>
<!-- content end -->
	
</div>


<div class="am-modal am-modal-no-btn" tabindex="-1" id="item_qrcode">
  <div class="am-modal-dialog">
    <div class="am-modal-hd"><i class="am-icon-hand-o-down"></i> 微信扫一扫查看
      <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close="">×</a>
    </div>
    <div class="am-modal-bd">
      <img id="itemqrcodesrc" src="" style="margin: 10px 0px 10px 0px;height: 200px;">
    </div>
  </div>
</div>
<script type="text/javascript">
    $(function () {
        var xOffset = 55;
        var yOffset = 55;
        var imgWid = 0;
        var imgHei = 0; //变量初始化
        var big = 2;//放大倍数
        var w = $(window).width();
        $(".hover").hover(function () {
            $(this).find("img").stop(true, true);

           var str = $(this).find("img").attr('src');   
            $("body").append("<div id='preview'><div><img class='hoverimg' src='" + str.replace(/100x100/, "300x300")  + "' /></div></div>");
           
            $("#preview").css({
                
                position:"absolute",
                padding:"1px",
                border:"1px solid #f3f3f3",
                backgroundColor:"#eeeeee",
                top: $(this).find("img").offset().top + yOffset + "px",
                left: $(this).find("img").offset().left + xOffset + "px",
                zIndex: 1000
            })

            $(".hoverimg").css({
                width: 200,
                height: 200
            })

        }, function () {
            $("#preview").remove();
        });
    })


$('.editcolumn').click(function(){
    $('#my-edit-s').modal({
       relatedTarget: this,
       onConfirm: function(e) {
     	var first_content=$.trim($('#first').val());
     	var second_content=$.trim($('#second').val());
     	var third_content=$.trim($('#third').val());
  
     	$.ajax({
	     	type:'post',
	     	url:"/item/edit_column.html",
	     	data:{'first_content':first_content,'second_content':second_content,'third_content':third_content},
	     	dataType:'json',
	     	success:function(data){	     		
	     		if(data.status==1){
	     			$("#fq_confirm_info").text(data.info);
				$('#fq_confirm').modal({
					closeViaDimmer:false,
					relatedTarget: this,
					onConfirm: function(options) {
						window.location.reload();
					},
					onCancel: function() {}
				});
									
	     		}else{
	     			$("#fq_alert_info").text(data.info);
				$('#fq_alert').modal();
	     		}
                   		
	     	}

     	});
      },
     
    

  });
});



$('.edit_message li').mouseover(function(){
     $(this).css("background-color","#3bb4f2");
});
$('.edit_message li a').mouseover(function(){
     $(this).css("background-color","#3bb4f2");
});
$('.edit_message li').mouseout(function(){
     $(this).css("background-color","");
});
$('.edit_message li a').mouseout(function(){
     $(this).css("background-color","");
});





//图片上传
	//-------------------------------------------------------------------
	var token = 'TALGCXKIF_psFdV2hV_wiuaDow8cJpuZr4APGvWx:Qh-ufZL3nM1-2bLVjxGJqmaF1fY=:eyJzY29wZSI6ImZxYXBwcyIsImRlYWRsaW5lIjoxNDc3MDYyNDQ3fQ==';
	$('#priceimg').change(function(){
		var key = $(this).attr('data-key');
		var file = $(this)[0].files[0];
		//console.log(file);
		if(file.type.indexOf("image") == 0){
			if(file.size >= 5120000){
				$('#fq_alert_info').text('图片大小过大');
				$('#fq_alert').modal({});
				return;
			}
		}else{
			$('#fq_alert_info').text('您选择的不是图片哦！');
			$('#fq_alert').modal({});
			return;
		}
		
		var reader = new FileReader();
		reader.readAsDataURL(file);
		reader.onload = function(e){
			if (file.size > 0 && token != "") {
				Qiniu_upload(file,token,key);
			}else if(file.size == 0){
				$('#fq_alert_info').text('您选择的是空文件');
				$('#fq_alert').modal({});
			}else if(token == ''){
				$('#fq_alert_info').text('token获取失败');
				$('#fq_alert').modal({});
			}
			
		}
		
	});
	
	var Qiniu_UploadUrl = "https://up.qbox.me";
    var Qiniu_upload = function(f, token,key) {
		var xhr = new XMLHttpRequest();
		xhr.open('POST', Qiniu_UploadUrl, true);
		var formData, startDate;
		formData = new FormData();
		formData.append('token', token);
		formData.append('file', f);

		xhr.onreadystatechange = function(response) {
			if (xhr.readyState == 4 && xhr.status == 200 && xhr.responseText != "") {
				var obj = JSON.parse(xhr.responseText); 
				if(obj.hash){
					var imgsrc = ""+obj.hash+"-310x310";
				//	$("#priceimg").val(imgsrc);
					$('.imgbox').html('<img src="'+imgsrc+'" width="50px" height="50px" />');
				}else{
					$('#fq_alert_info').text('图片上传失败');
					$('#fq_alert').modal({});
				}
				
			}else if (xhr.status != 200 && xhr.responseText) {
				$('#fq_alert_info').text('图片上传失败');
				$('#fq_alert').modal({});
			}
		};
		startDate = new Date().getTime();
        xhr.send(formData);
    };
    
	
	
	//排序
	$('#sorting').change(function(){
		
		
		//优惠最多
		if($(this).val()==0){
		
			if(1==0){
			
				if(0==0){
					window.location.href = "";
				}else{
					window.location.href = "";
				}
				
			}else{
				if(0==0){
					window.location.href = "";
				}else{
					window.location.href = "";
				}
			}
		}
		
		//销量最高
		if($(this).val()==1){
			
			if(1==0){ //排序类型为全部的大前提
				if(0==0){	//类目为全部
					window.location.href = "";
				}else{	//类目不为全部
					window.location.href = "";
				}
				
			}else{ //排序类型不为全部的大前提
			
				if(0==0){ //类目为全部
					window.location.href = "";
				}else{	//类目不为全部
					window.location.href = "";
				}
				
			}	
		}
		
		//佣金比率最高
		if($(this).val()==2){
			if(1==0){
				if(0==0){
					window.location.href = "";
				}else{
					window.location.href = "";
				}	
			}else{
				if(0==0){
					window.location.href = "";
				}else{
					window.location.href = "";
				}
			}	
			
		}
		
		//发布时间
		if($(this).val()==3){
			if(1==0){
				if(0==0){
					window.location.href = "";
				}else{
					window.location.href = "";
				}
			}else{
				if(0==0){
					window.location.href = "";
				}else{
					window.location.href = "";
				}				
			}
		}
		
		if($(this).val()==4){
				if(1==0){
					if(0==0){
						window.location.href = "";
					}else{
						window.location.href = "";
					}
				}else{
					if(0==0){
						window.location.href = "";
					}else{
						window.location.href = "";
					}				
				}
		}
	});
</script>
<script>
	function test(arr,i,len){
		if(i >= len){
			$('#fq_alert').modal('close');
			$('#fq_alert_info_second').text('商品顺序已被打乱');
			$('#fq_alert_second').modal({});
			$('.regain,.upset').attr('disabled',false);
			return;
		}
		$.post('/Item/upset',{"item":arr[i]},function(res,status){
			if(status == 'success'){
				if(res.status == 1){
					var html = $('.upsetbox').html();
					$('.upsetnum').text(parseInt(i*500)+arr[i].length);
					//$('#fq_alert_info').html('正在打乱商品顺序，请勿关闭页面<br>'+html);
					i = i + 1;
					test(arr,i,len);
				}
			}
		});
	}
	$(function(){
		//恢复
		$('.regain').click(function(){
			$('.regain,.upset').attr('disabled',true);
			$.post('/Item/regain',{},function(res){
				$('#fq_alert_info').text(res.info);
				$('#fq_alert').modal({});
				$('.regain,.upset').attr('disabled',false);
				return;
			});
		});
		//打乱
		$('.upset').click(function(){
			$('.regain,.upset').attr('disabled',true);
			$.ajax({
				type:'post',
				url:'/Item/upsetid',
				success:function(res){
					if(res.status == 1){
						var len = res.info.length;//数组长度
						var idlen = 0;
						for(var i = 0;i< len;i++){
							idlen = idlen + res['info'][i].length;
						}
						var html = $('.upsetbox').html();
						$('#fq_alert_info').html('正在打乱商品顺序，请勿关闭页面<br>'+html);
						$('.upsetbox').show();
						$('.upsetnum').text(0);
						$('.upsettotal').text(' / '+idlen);
						$('#fq_alert').modal({});
						test(res.info,0,len);
					}else{
						$('#fq_alert_info').text(res.info);
						$('#fq_alert').modal({});
						$('.regain,.upset').attr('disabled',false);
						return;
					}
				},
				complete:function(XMLHttpRequest,status){
					if(XMLHttpRequest.status != 200){
						$('#fq_alert_info').text('网络连接错误');
						$('#fq_alert').modal({});
						$('.regain,.upset').attr('disabled',false);
						return;
					}
				}
			});
		});
	});
</script>
<div class="am-modal am-modal-alert" tabindex="-1" id="fq_alert_second">
  	<div class="am-modal-dialog">
    	<div class="am-modal-hd"></div>
    	<div class="am-modal-bd" id="fq_alert_info_second">
    	</div>
    	<div class="am-modal-footer">
      		<span class="am-modal-btn">确定</span>
    	</div>
  	</div>
</div>
</body></html>